package com.ty.day3;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : txy
 * @Create 2023/10/30 14:32
 */
public class Six {
    public static void main(String[] args) {
        int[] a = {1, 12, 23, 24, 36, 37, 48, 49, 70}, b = new int[a.length + 1];
        System.out.println(Arrays.toString(a));
        System.out.print("请输入一个整数：");
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(), p = a.length;
        for (int i = 0; i < a.length - 1; i++) {
            if (x <= a[i]) {
                p = i;
                break;
            }
        }
        for (int i = 0; i < a.length; i++) {
            if (i >= p) {
                b[i + 1] = a[i];
            } else {
                b[i] = a[i];
            }
        }
        b[p] = x;
        System.out.println(Arrays.toString(b));

    }
}
